package com.example.easyutils.httputil;

import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;

public class HttpPostRequest {

//    MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
//RequestBody body = RequestBody.create(mediaType, "keyword=十九大春风化雨");
    public static void sendOkHttpPostRequst(String address, RequestBody body, Callback callback){
        OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
                .post(body)
                .url(address)
                .addHeader("Content-Type", "application/x-www-form-urlencoded")
                .build();
        client.newCall(request).enqueue(callback);
    }
}
